//
//  ACUserModel.m
//  ArtCircle
//
//  Created by sunbin on 2017/5/21.
//  Copyright © 2017年 HuaYue. All rights reserved.
//

#import "ACUserModel.h"


@interface ACUserModel()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end


@implementation ACUserModel



- (void)setValue:(id)value forUndefinedKey:(NSString *)key  {
    if([key isEqualToString:@"id"])
        self.getnewid = value;
}


+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}



#if 0
处理id字段
+ (NSDictionary *)replacedKeyFromPropertyName{
    
    return @{@"getnewid":@"id"};
    
}

#endif


- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];
    
    if(self && [dict isKindOfClass:[NSDictionary class]]) {
        self.brokerId = [self objectOrNilForKey:@"brokerId" fromDictionary:dict];
        self.loginemail = [self objectOrNilForKey:@"loginemail" fromDictionary:dict];
        self.permanentregion = [self objectOrNilForKey:@"permanentregion" fromDictionary:dict];
        self.unionid = [self objectOrNilForKey:@"unionrd" fromDictionary:dict];
        self.openid = [self objectOrNilForKey:@"openrd" fromDictionary:dict];
        self.broker = [self objectOrNilForKey:@"broker" fromDictionary:dict];
        self.del = [self objectOrNilForKey:@"del" fromDictionary:dict] ;
        self.deldtm = [self objectOrNilForKey:@"deldtm" fromDictionary:dict];
        self.sex = [self objectOrNilForKey:@"sex" fromDictionary:dict] ;
        self.nickname = [self objectOrNilForKey:@"nickname" fromDictionary:dict];
        self.constellation = [self objectOrNilForKey:@"constellation" fromDictionary:dict];
        self.query = [self objectOrNilForKey:@"query" fromDictionary:dict];
        self.personalsignature = [self objectOrNilForKey:@"personalsignature" fromDictionary:dict];
        self.hxPsw = [self objectOrNilForKey:@"hxPsw" fromDictionary:dict];
        self.signature = [self objectOrNilForKey:@"signature" fromDictionary:dict];
        self.realname = [self objectOrNilForKey:@"realname" fromDictionary:dict];
        self.fanscount = [self objectOrNilForKey:@"fanscount" fromDictionary:dict];
        self.job = [self objectOrNilForKey:@"job" fromDictionary:dict];
        self.getnewid = [self objectOrNilForKey:@"id" fromDictionary:dict];
        self.headurl = [self objectOrNilForKey:@"headurl" fromDictionary:dict];
        self.token = [self objectOrNilForKey:@"token" fromDictionary:dict];
        self.label = [self objectOrNilForKey:@"label" fromDictionary:dict];
        self.phone = [self objectOrNilForKey:@"phone" fromDictionary:dict];
        self.attentioncount = [self objectOrNilForKey:@"attentioncount" fromDictionary:dict];
        self.realnameon = [self objectOrNilForKey:@"realnameon" fromDictionary:dict];
        self.pastdtm = [self objectOrNilForKey:@"pastdtm" fromDictionary:dict];
        self.openidapp = [self objectOrNilForKey:@"openidapp" fromDictionary:dict];
        self.password = [self objectOrNilForKey:@"password" fromDictionary:dict];
        self.createdtm = [self objectOrNilForKey:@"createdtm" fromDictionary:dict];
        self.username = [self objectOrNilForKey:@"username" fromDictionary:dict];
        
        
    }
    
    return self;
    
}


- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:aKey];
    return [object isEqual:[NSNull null]] ? nil : object;
}

@end
